package com.itheima.controller;


import com.itheima.pojo.Result;
import com.itheima.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {

    @Autowired
    private ReportService reportService;

    //员工职位人数统计
    @GetMapping("/empJobData")
    public Result empJobData(){
        log.info("员工职位人数统计");
        //调用业务层方法
        return Result.success(reportService.empJobCount());
    }

    //员工性别人数统计
    @GetMapping("/empGenderData")
    public Result genderCount(){

        List<Map> list = reportService.empGenderData();
        return Result.success(list);
    }

    //学员学历统计
    @GetMapping("/studentDegreeData")
    public Result studentDegreeData(){
        List<Map> list = reportService.studentDegreeData();
        return Result.success(list);
    }

    //班级人数统计
    @GetMapping("/studentCountData")
    public Result studentCountData(){
        Map map = reportService.studentCountData();
        return Result.success(map);
    }
}
